package splatform.webchatbot.control;

import com.jerei.web.utils.UtilsUI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * Created by sunfeihu on 2017/3/15.
 */
@Controller
@RequestMapping(value = "/admin/webchatbot/type")
public class BotTypeControl {
    @Autowired
    private JdbcTemplate jdbcTemplate;


    @RequestMapping(value = "/list")
    public String list(Model model) {
        return "/admin/webchatbot/type/list";
    }

    @RequestMapping(value = "/page")
    @ResponseBody
    public String page(Model model) {
        List<Map<String, Object>> list = jdbcTemplate.queryForList(" select * from bot_type order by id desc ");
        return UtilsUI.datagrid(list);
    }
}
